// Package dao
/*
@Coding : utf-8
@Time : 2023/3/11 22:41
@Author : yizhigopher
@Software : GoLand
*/
package dao

import (
	"ginchat/internal/globals/databases"
	"ginchat/internal/models"
)

type UserDao struct {
	models.UserModel
}

func (u *UserDao) Get(args map[string]interface{}) error {
	mysqlManager := databases.GetMySQLClient()
	return mysqlManager.Where(args).Where(map[string]interface{}{
		"is_deleted": 0,
	}).Take(u).Error
}

func (u *UserDao) Add() error {
	mysqlManager := databases.GetMySQLClient()
	return mysqlManager.Create(&u).Error
}
